<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/FCKeditor.tld" prefix="fck" %>
<%@page import="java.util.*,model.*,util.*,control.*"%>
<!DOCTYPE html>
<html>
<head>
    <title>自适应测评系统</title>
    <meta charset="utf-8"/>
    <script  src='../../js/core.js'></script>
    <script  src='../../js/jquery-1.4.2.js'></script>
    <script  src='../../js/rows.js'></script>
    <link type="text/css" rel='stylesheet' href="../../css/common.css"/>
    <link type="text/css" rel='stylesheet' href="../../css/houtai.css"/>
</head>
<body>
           <%
           /***********************************************************************************/
           /*
           *验证权限
           *author 胡瑾
           *data 2011-12-08
           */
			String flag = (String)session.getAttribute("flag");
			String userId = (String)session.getAttribute("userId");
			int adminId = Integer.parseInt(userId);
						
			if (flag != "admin"|| flag == null )
			{
				%>
      <script language="javascript">
				     alert("您没有管理员权限,请重新登录"); window.location.href="../../index.jsp";
				    </script>
      <%
				
			}else{
				Admin admin = new Admin();
				AdminControl ac = new AdminControl();
				admin = ac.GetAdmin(adminId);
				//out.print("<p>"+admin.getName()+"   欢迎您</p>");
				
			}
			/*********************************************************************************/
           %>
        <form method="post">
  <table class='main' width='98%'>
  <thead>
    <tr>
      <td width='100'>序号</td>
      <td width='100'>使用次数</td>
      <td width='100'>答对次数</td>
      <td width='150'>答错次数</td>
      <td width='200'>平均反应时间</td>
    </tr>
    </thead>
    <%
		int k = 0;
		request.setCharacterEncoding("utf-8");
		int pages = ParamUtil.getInt(request, "pages", 1);
		int rowsPerPage = ParamUtil.getInt(request, "pageSize", 20);
		Problem problem = new Problem();
		ProblemControl pc = new ProblemControl();
		
		List<Problem>list = new ArrayList<Problem>();
		list = (List)pc.GetProblem(pages,rowsPerPage);
		//problem = pc.GetProblem(list.size());
		//for(int i = 0; i<list.size();i++)
		for(int i = list.size() - 1; i >= 0; i --)
		{
			problem = list.get(i);
			k++;
	%>
	<tbody>
    <tr >
      <td><%=k %></td>
      <td><%=problem.getSelectNum() %></td>
      <td><%=problem.getCorrectNum() %></td>
      <td><%=problem.getSelectNum() - problem.getCorrectNum() %></td>
      <td><%=problem.getResponseTime() %></td>
    </tr>
    <%
	    }
	    %>
	    </tbody>
  </table>
        <p style='margin-left: 20px;'><%
		out.println(ProblemControl.pageInstance.getToolsMenu(pages));
		%></p>
    </form>
</body>
</html>
